﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="d" uri="/WEB-INF/resource.tld" %>

<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<sec:authentication property="principal" var="currentPrincipal" scope="page" />

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />
<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>
  
</head>

<body>

  <%@ include file="/WEB-INF/include/header.jsp"%>
  
  <%@ include file="/WEB-INF/include/menu.jsp"%>

  <div class="container main-content">

    <div class="panel panel-default x-panel x-panel-layout">

      <div class="panel-heading">
        <ol class="breadcrumb">
          <li><a href="${ctx.host}/online-rounds">课程管理</a></li>
          <li class="active">饮食计划管理</li>
        </ol>
      </div>

      <div class="panel-body">

        <div class="col-xs-2 x-panel-layout-left no-horizontal-padding">
          <%@ include file="/WEB-INF/include/submenu.jsp"%>
        </div>

        <div class="col-xs-10 x-panel-layout-right">

          <div class="x-breadcrumb-wrapper">
            <div class="x-breadcrumb clearfix">
              <h2><i class="glyphicon glyphicon-fire" title=""></i>&nbsp;&nbsp;<span>饮食计划管理&nbsp;-&nbsp;饮食计划列表</span></h2>
            </div>
            
            <c:if test="${currentPrincipal.coursewareManager}">
              <div class="x-breadcrumb-wrapper clearfix" style="position: relative; margin-top: 15px;">
                <div class="btn-group pull-right">
                  <a href="${ctx.host}/dietary-program-templates/create"  data-target="#create" data-toggle="modal" class="btn btn-default x-btn btn-shadow btn-shadow-default">
                    <i class="glyphicon glyphicon-plus"></i>&nbsp;&nbsp;新增
                  </a>
                </div>
              </div>
            </c:if>
            
          </div>
         
          <table class="table table-striped table-hover x-table action-table" style="margin-bottom:20px;">
            <thead>
              <tr>
                <th>名称</th>
                <th>类型</th>
                <th>描述</th>
                <c:if test="${currentPrincipal.coursewareManager}">
                  <th class="text-center">操作</th>
                </c:if>
              </tr>
            </thead>
            <tbody>
              <c:forEach var="dietaryProgramTemplate" items="${dietaryProgramTemplates}">
                <tr>
                    <td>${dietaryProgramTemplate.name}</td>
                    <td>${dietaryProgramTemplate.type.description}</td>
                    <td style="max-width:160px;" class="ellipsis">${dietaryProgramTemplate.description}</td>
                    <c:if test="${currentPrincipal.coursewareManager}">
                      <td>
                        <a href="${ctx.host}/dietary-program-templates/${dietaryProgramTemplate.id}/edit" data-target="#edit" data-toggle="modal">修改</a>&nbsp;&nbsp;
                        <a href="${ctx.host}/dietary-program-templates/${dietaryProgramTemplate.id}/delete" data-target="#delete" data-toggle="modal">删除</a>
                      </td>
                    </c:if>
                  </tr>
                </c:forEach>
                  
            </tbody>
          </table>
          <jsp:include page="/WEB-INF/include/page.jsp">
            <jsp:param name="url" value="dietary-program-templates" />
            <jsp:param name="queryString" value="${queryString}" />
          </jsp:include>

        </div>
      </div>
    </div>
  </div>

  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource root="${ctx.resource}/build" type="script" src="js/page/courseware/dietary-program-template-list.js">
    <script type="text/javascript">
      require(['page/courseware/dietary-program-template-list'], function(page) {
        page.init()
      })
    </script>
  </d:resource>
  
</body>

</html>
